home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / wardial.arc / RCV_ASC.PAS next >
Pascal/Delphi Source File  |  1986-04-30  |  3KB  |  113 lines

  1. Procedure rcv_asc;
  2. var a,b:char;
  3.     tempbuff:array[1..256] of char;
  4.     infile:text;
  5.     file_name:string[20];
  6.     ok,go_back:boolean;
  7.     pointer,i:integer;
  8. begin
  9.   pointer:=1;
  10.   go_back:=false;
  11.   xcoord:=wherex;
  12.   ycoord:=wherey;
  13.   Move(screen1,screen2,4000);
  14.   Normvideo;
  15.   lowvideo;
  16.   Window(1,1,80,21);
  17.   normvideo;
  18.   textcolor(cyan);
  19.   frame(14, 5,36,11);
  20.   lowvideo;
  21.   window(15,6,35,10);
  22.   repeat
  23.      clrscr;
  24.      gotoxy(1,1);
  25.      textcolor(white);
  26.      writeln('    Recieve (Ascii)');
  27.      beep;
  28.      textcolor(7);
  29.      writeln;
  30.      Writeln(' Enter File Name ');write(' > ');
  31.      Readln(File_name);
  32.      if length(file_name)>0 then
  33.      begin
  34.      assign(infile, file_name);
  35.      {$I-} Rewrite(infile) {$I+};
  36.      ok:=(IOResult=0);
  37.      end
  38.      else
  39.         begin
  40.         ok:=true;
  41.         go_back:=true;
  42.         end;
  43.      if not ok then
  44.            begin
  45.                  writeln(' Exists: Rewrite ?');
  46.                  repeat until keypressed;
  47.                  read(kbd,a);
  48.                  if (a=chr(89)) or (a=chr(121)) then ok:=true;
  49.             end;
  50.      delay(2000);
  51.   until ok;
  52.   if not go_back then
  53.   begin
  54.   normvideo;
  55.   lowvideo;
  56.   Window(1,1,80,21);
  57.   gotoxy(1,1);
  58.   insline;
  59.   textcolor(white+blink);
  60.   write(chr(16):21);
  61.   textcolor(7);
  62.   write(' RECIEVE FILE <Alt-R> to terminate ');
  63.   textcolor(white+blink);
  64.   writeln(chr(17));
  65.   normvideo;
  66.   lowvideo;
  67.   window(1,2,80,21);
  68.   ClrScr;
  69.   gotoxy(1,21);
  70.   textcolor(maincolor);
  71.   repeat
  72.      if commpressed then
  73.         begin
  74.              b:=cinkey;
  75.              tempbuff[pointer]:=b;
  76.              write(b);
  77.              pointer:=pointer+1;
  78.              if pointer=256 then
  79.                              begin
  80.                                   for i:=1 to 255 do
  81.                                            begin
  82.                                                 write(infile,tempbuff[i]);
  83.                                             end;
  84.                                   pointer:=1;
  85.                               end;
  86.          end;
  87.              if keypressed then
  88.                  begin
  89.                      read(kbd,a);
  90.                      if a<>chr(19) then write_byte(a);
  91.                  end;
  92.  
  93.   until a=chr(19);
  94.   for i:=1 to pointer do
  95.       begin
  96.            write(infile,tempbuff[i]);
  97.       end;
  98.   close(infile);
  99.   writeln;writeln;writeln('DONE.');
  100.   delay(2000);beep;beep;
  101.   end;
  102.   normvideo;
  103.   move(screen2,screen1,4000);
  104.   lowvideo;
  105.   window(1,1,80,21);
  106.   Textcolor(maincolor);
  107.   gotoxy(xcoord,ycoord);
  108.  end;
  109.  
  110.  
  111.  
  112.  
  113.